package cm.day05.Test4;

public class CalculatorDemo {
    public static void main(String[] args) {
        useCalculator(new Calculator() {
            @Override
            public int calc(int a, int b) {
                return a+b;
            }
        });
        //Lambda表达式
        useCalculator((int a,int b)->{
            return a-b;
        });
        //Lambda简化表达式
        useCalculator((a,b)->a-b);
    }
    public static void useCalculator(Calculator calculator){
       int c= calculator.calc(12,15);
        System.out.println(c);
    }
}
